package com.batis.source.session;

import com.batis.mapper.MYEnvironment;
import org.apache.ibatis.datasource.pooled.PooledDataSourceFactory;
import org.apache.ibatis.type.TypeAliasRegistry;

import java.util.Properties;

/**
 * 文件配置中心
 * @author isam2016
 * @create 2021-08-26 2:01 PM
 */
public class MYConfiguration {

    protected MYEnvironment environment;
    // 硬编码配置
    protected Properties variables = new Properties();

    protected final TypeAliasRegistry typeAliasRegistry = new TypeAliasRegistry(); // todo: 使用原生的

    public MYConfiguration(MYEnvironment environment) {
        this();
        this.environment = environment;
    }
    public MYConfiguration(){
        // todo 使用了原始框架
        typeAliasRegistry.registerAlias("POOLED", PooledDataSourceFactory.class.getName());
    }
    public void setVariables(Properties variables) {
        this.variables = variables;
    }

    public void setEnvironment(MYEnvironment environment) {
        this.environment = environment;
    }

    public TypeAliasRegistry getTypeAliasRegistry() {
        return typeAliasRegistry;
    }
}
